Skip to content

Enforce storage limits for Local Share uploads and ZIPs - #46

Merged
UserJoo9 merged 1 commit into
UserJoo9:mainfrom
compnew2006:codex/local-share-upload-limits
Nov 24, 2026
Merged

UserJoo9 merged 1 commit into
UserJoo9:mainfrom
compnew2006:codex/local-share-upload-limits

Conversation

@compnew2006

@compnew2006 compnew2006 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem and impact

Local Share wrote incoming payloads to the gateway filesystem without per-file or cache-wide limits. The ordinary upload, folder archives, and temporary download bundles write to the same cache. Concurrent transfers could consume available disk space and disrupt the gateway or its database.

Changes

  • Enforce a 1 GiB cap per uploaded file, uncompressed folder entry, and generated ZIP. Apply one 4 GiB cache budget to stored payloads, concurrent uploads, and temporary ZIPs. Stop payload growth before it would leave less than 256 MiB of free disk space.
  • Enforce the limits as bytes arrive and as ZIPs grow, including when an upload has no declared length. Return HTTP 413 on a limit violation, remove the partial payload, and leave previously published files available.
  • Account for payloads already on disk at startup. Reclaim abandoned folder sessions after 30 minutes of inactivity on the next cleanup pass. Document the limits and folder retry behavior.

User impact

Uploads within the limits keep their existing response and download behavior. Oversized transfers or a full cache now produce a 413 response. If a folder upload is rejected, users can start a new folder upload. The limits apply to disk-backed Local Share.

Verification

  • GitHub Actions on Linux passed lint and all 1,079 tests on Python 3.12.
  • 30 Local Share tests passed on Python 3.12, covering LAN access, exact limits, streamed rejection, parallel uploads, the disk reserve, ZIP finalization, and cleanup. Both streaming regression cases returned 200 on the base commit and 413 with the fix.
  • Real HTTP over Uvicorn from a same-host client on a private IPv4 interface confirmed acceptance at the file limit, 413 at the cache limit, and 413 with cleanup after the first chunk of an upload without Content-Length had been written.
  • pyflakes api core quota tests run.py and git diff --check passed.
  • The full macOS suite had an existing failure in tests/test_updater.py::test_auto_install_fires_after_check, reproduced on the base commit. One full run also hit an intermittent DHCP fallback assertion in tests/test_run_wiring.py. That test passed in isolation on both the base and the PR branch.

@UserJoo9

Copy link
Copy Markdown
Owner

Thanks a lot for these. We're shipping the Netrex rename (0.5.11) first and will review them right after it, starting with the smaller fixes. The repository is now UserJoo9/Netrex; your PRs move with it automatically, no action needed.

UserJoo9 added a commit that referenced this pull request Nov 24, 2026
@UserJoo9
UserJoo9 merged commit fa96849 into UserJoo9:main Nov 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants